import 'package:flutter/material.dart';
import 'Form.dart';

class CategoryPage extends StatefulWidget {
  CategoryPage({Key? key}) : super(key: key);

  @override
  _CategoryState createState() => _CategoryState();
}

class _CategoryState extends State<CategoryPage> {
  @override
  Widget build(BuildContext context) {
    return Container(
      child: ElevatedButton(
          onPressed: () {
            //路由跳转，可以理解成页面入栈，然后出栈就是返回原先页面。任何一个新页面都要在Navigator里压栈，返回在Navigator里出栈
            Navigator.of(context).push(MaterialPageRoute(
                //FromPage有入参
                builder: (context) => FormPage("the value from category")));
          },
          child: Text('go to form page')),
    );
  }
}
